//
//  ShopOrderInfoTableViewController.m
//  GoodWayClient
//
//  Created by HuiDong on 15/12/9.
//  Copyright © 2015年 HuiDong. All rights reserved.
//

#import "ShopOrderInfoTableViewController.h"
#import "DropDown1.h"
#import "GoShopSuccessViewController.h"

@interface ShopOrderInfoTableViewController ()<UITextFieldDelegate>

@property (weak, nonatomic) IBOutlet UIButton *btn1;
@property (weak, nonatomic) IBOutlet UIButton *btn3;
@property (weak, nonatomic) IBOutlet UIButton *btn2;
@property (nonatomic, strong)NSDictionary *dic;
@property (nonatomic, strong)NSDictionary *dic1;
@property (nonatomic, strong)NSDictionary *dic2;
@property (weak, nonatomic) IBOutlet UITextField *remark;


- (IBAction)back:(id)sender;
@end

@implementation ShopOrderInfoTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //请选择收货地址
    DropDown1 *dd1 = [[DropDown1 alloc] initWithFrame:CGRectMake(0,[[UIScreen mainScreen] bounds].size.width*0.28, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height*0.05)];
    dd1.textField.placeholder = @"请选择收货地址";
    dd1.textField.delegate = self ;
    NSArray* arr=[[NSArray alloc]initWithObjects:@"河北省",@"山西省",@"辽宁省",@"吉林省",@"黑龙江省",@"江苏省",@"浙江省",@"安徽省",@"福建省",@"江西省",@"山东省",@"河南省",@"湖北省",@"湖南省",@"广东省",@"海南省",@"四川省",@"贵州省",@"云南省",@"陕西省",@"甘肃省",@"青海省",@"台湾省",@"内蒙古自治区",@"广西壮族自治区",@"西藏自治区",@"宁夏回族自治区",@"新疆维吾尔自治区",@"香港特别行政区",@"澳门特别行政区",nil];
    dd1.tableArray = arr;
    [self.view addSubview:dd1];
    
    //时间不限
    DropDown1 *dd2 = [[DropDown1 alloc] initWithFrame:CGRectMake(0,[[UIScreen mainScreen] bounds].size.width*0.38, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height*0.05)];
    dd2.textField.placeholder = @"时间不限";
    dd2.textField.delegate = self ;
    NSArray* arr2=[[NSArray alloc]initWithObjects:@"河北省",@"山西省",@"辽宁省",@"吉林省",@"黑龙江省",@"江苏省",@"浙江省",@"安徽省",@"福建省",@"江西省",@"山东省",@"河南省",@"湖北省",@"湖南省",@"广东省",@"海南省",@"四川省",@"贵州省",@"云南省",@"陕西省",@"甘肃省",@"青海省",@"台湾省",@"内蒙古自治区",@"广西壮族自治区",@"西藏自治区",@"宁夏回族自治区",@"新疆维吾尔自治区",@"香港特别行政区",@"澳门特别行政区",nil];
    dd2.tableArray = arr2;
    [self.view addSubview:dd2];
    
    //请选择配送方式
    DropDown1 *dd3 = [[DropDown1 alloc] initWithFrame:CGRectMake(0,[[UIScreen mainScreen] bounds].size.width*0.48, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height*0.05)];
    dd3.textField.placeholder = @"请选择配送方式";
    dd3.textField.delegate = self ;
    NSArray* arr3=[[NSArray alloc]initWithObjects:@"河北省",@"山西省",@"辽宁省",@"吉林省",@"黑龙江省",@"江苏省",@"浙江省",@"安徽省",@"福建省",@"江西省",@"山东省",@"河南省",@"湖北省",@"湖南省",@"广东省",@"海南省",@"四川省",@"贵州省",@"云南省",@"陕西省",@"甘肃省",@"青海省",@"台湾省",@"内蒙古自治区",@"广西壮族自治区",@"西藏自治区",@"宁夏回族自治区",@"新疆维吾尔自治区",@"香港特别行政区",@"澳门特别行政区",nil];
    dd3.tableArray = arr3;
    [self.view addSubview:dd3];
    
    self.remark.delegate = self;
}
//用于隐藏键盘的方法（怎么进不去？）
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [self.view endEditing:YES]; //这句代码可以隐藏键盘
    return YES;
}

- (IBAction)submitPayClick:(id)sender {
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    GoShopSuccessViewController *success = [storyboard instantiateViewControllerWithIdentifier:@"GoShopSuccessViewController"];
    [self presentViewController:success animated:YES completion:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

//懒加载
- (NSDictionary *)dic
{
    if (!_dic) {
        _dic = @{@"image":@"logo",@"discri":@"描述详细的商品信息!",@"money":@"200积分+90元",@"amount":@"X1",@"number":@"共1件"};
    }
    return _dic;
}
- (NSDictionary *)dic1
{
    if (!_dic1) {
        _dic1 = @{@"1":@"$290.00",@"2":@"$200.00",@"3":@"$0.00",@"4":@"$90.00"};
    }
    return _dic1;
}
- (NSDictionary *)dic2
{
    if (!_dic2) {
        _dic2 = @{@"comment":@"(选填)"};
    }
    return _dic2;
}

- (IBAction)back:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}

//隐藏工具栏
-(BOOL)prefersStatusBarHidden
{
    return YES;
}
- (IBAction)btn1Click:(id)sender {
        [self.btn1 setBackgroundImage:[UIImage imageNamed:@"shopCarSelected.png"] forState:UIControlStateNormal];
        [self.btn2 setBackgroundImage:[UIImage imageNamed:@"order1.png"] forState:UIControlStateNormal];
        [self.btn3 setBackgroundImage:[UIImage imageNamed:@"ok.png"] forState:UIControlStateNormal];
    
}
- (IBAction)btn3Click:(id)sender {
    [self.btn1 setBackgroundImage:[UIImage imageNamed:@"shopCar.png"] forState:UIControlStateNormal];
    [self.btn2 setBackgroundImage:[UIImage imageNamed:@"order.png"] forState:UIControlStateNormal];
    [self.btn3 setBackgroundImage:[UIImage imageNamed:@"okSelected.png"] forState:UIControlStateNormal];
}
- (IBAction)btn2Click:(id)sender {
    [self.btn1 setBackgroundImage:[UIImage imageNamed:@"shopCar.png"] forState:UIControlStateNormal];
    [self.btn2 setBackgroundImage:[UIImage imageNamed:@"orderSelected.png"] forState:UIControlStateNormal];
    [self.btn3 setBackgroundImage:[UIImage imageNamed:@"ok.png"] forState:UIControlStateNormal];
}


@end
